<?php
/**
 * Created by PhpStorm.
 * User: tommy
 * Date: 2018/11/16
 * Time: 10:53
 */

namespace backend\modules\system\controllers;


use backend\component\BackendBaseController;
use backend\service\ArticleService;
use common\models\base\HotWord;

class SearchController extends BackendBaseController
{

    public function actions()
    {
        return [
            "modify" => [
                'class' => "backend\actions\ModifyAction",
                'modelName'=> HotWord::className()
            ],
        ];
    }

    public function actionIndex() {}


    public function actionList() {
        if (\Yii::$app->request->getIsAjax()) {
            return ArticleService::hotWordDataList(\Yii::$app->request->post());
        }
        $model = new HotWord();
        return $this->render("list",['model'=>$model]);
    }

    public function actionEdit() {
        $id = \Yii::$app->request->get("id",0);
        $model = HotWord::modelById($id);
        return $this->render("edit",['model'=>$model]);
    }
}